#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: ix-cache
# REQUIRE: LOGIN

. /etc/rc.freenas

populate_cache()
{
	if dirsrv_enabled activedirectory ||
		dirsrv_enabled nis ||
		dirsrv_enabled ldap
	then
		/usr/local/www/freenasUI/tools/cachetool.py fill
	fi
}

expire_cache()
{
        /usr/local/www/freenasUI/tools/cachetool.py expire
}

name="ix-cache"
start_cmd='populate_cache'
stop_cmd='expire_cache'
            
load_rc_config $name
run_rc_command "$1"
